{include file="common/_meta" /}
<title>栏目添加</title>
<meta name="keywords" content="李志立，lizhilimaster@163.com">
<meta name="description" content="李志立，lizhilimaster@163.com">
</head>
<body>
<div class="page-container">
	<form action="" method="post" class="form form-horizontal" id="form-category-add">
		<input type="hidden"  value="{$data.id}" name="id">
		<div id="tab-category" class="HuiTab">
			<div class="tabCon">
				<div class="row cl">
					<label class="form-label col-xs-3 col-sm-2">
						<span class="c-red">*</span>
						上级栏目：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<span class="select-box">
						<select class="select" id="fid" name="fid">
							<option value="0">顶级分类</option>
							{volist name="datasort" id="vo"}
							<option {if condition="$vo.id == $data.fid "}selected="selected"{/if} value="{$vo.id}"><?php echo str_repeat("|--",$vo['level']);?>{$vo.catename}</option>
							{/volist}
						</select>
						</span>
					</div>
					<div class="col-3">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-3 col-sm-2">
						<span class="c-red">*</span>
						栏目名称：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="{$data.catename}" onKeyUp="zhuan()" placeholder="" id="catename" name="catename">
					</div>
					<div class="col-3">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-3 col-sm-2">
						<span class="c-red">*</span>
						英文名称：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="{$data.en_name}" placeholder="" id="en_name" name="en_name">
					</div>
					<div class="col-3">
					</div>
				</div>
				
				<div class="row cl">
					<label class="form-label col-xs-3 col-sm-2">跳转设置：</label>
					<div class="formControls col-xs-3 col-sm-3">
						<span class="select-box">
						<select name="tiao_type" class="select">
							<option  {if condition="$data.tiao_type == 0 "}selected="selected"{/if} value="0">不跳转</option>
							<option  {if condition="$data.tiao_type == 1 "}selected="selected"{/if} value="1">跳转栏目页</option>
							<option  {if condition="$data.tiao_type == 2 "}selected="selected"{/if} value="2">跳转详情页</option>
						</select>
						</span>
					</div>
					<label class="form-label col-xs-3 col-sm-2">跳转设置：</label>
					<div class="col-xs-3 col-sm-4">
						<input type="number" class="input-text" value="{$data.tiao_id!=0 ? $data.tiao_id : ''}" placeholder="请填写跳转id"  name="tiao_id" style="width: 100%;">
					</div>
					<div class="col-3">
					</div>
				</div>
				
				<div class="row cl">
					<label class="form-label col-xs-3 col-sm-2">栏目类型：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<span class="select-box">
						<select name="type" id="type" class="select">
							<option {if condition="$data.type == 1 "}selected="selected"{/if} value="1">文章列表</option>
							<option {if condition="$data.type == 2 "}selected="selected"{/if} value="2">单页</option>
							<option {if condition="$data.type == 3 "}selected="selected"{/if} value="3">图片列表</option>
							<option {if condition="$data.type == 4 "}selected="selected"{/if} value="4">远程链接</option>
						</select>
						</span>
					</div>
					<div class="col-3">
					</div>
				</div>
				
				
				<div {if condition="$data.type == 4 "} style='display: none;' {/if} class="row cl"  id="catehtml">
					<label class="form-label col-xs-3 col-sm-2">
						栏目模版：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<span class="select-box">
						<select name="catehtml" class="select">
							<option value>默认模版</option>
							{volist name="html" id="vo"}
							<option {if $vo.name==$data.catehtml} selected="selected" {/if} value="{$vo.name}">{$vo.name}</option>
							{/volist}
						</select>
						</span>
					</div>
					<div class="col-3">
					</div>
				</div>
				<div {if condition="$data.type == 2 or $data.type == 4 "} style='display: none;' {/if} class="row cl"  id="showhtml">
					<label class="form-label col-xs-3 col-sm-2">
						详情模版：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<span class="select-box">
						<select name="showhtml" class="select">
							<option value>默认模版</option>
							{volist name="html" id="vo"}
							<option {if $vo.name==$data.showhtml} selected="selected" {/if} value="{$vo.name}">{$vo.name}</option>
							{/volist}
						</select>
						</span>
					</div>
					<div class="col-3">
					</div>
				</div>
				
				
				<div class="row cl">
					<label class="form-label col-xs-3 col-sm-2">
						栏目关键字：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="{$data.keyword}" placeholder="" id="keyword" name="keyword">
					</div>
					<div class="col-3">
					</div>
				</div>
				<div class="row cl"  id="lian" {if condition="$data.type != 4 "} style='display: none;' {/if}>
					<label class="form-label col-xs-3 col-sm-2">
						<span class="c-red">*</span>
						链接地址：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="{$data.url}" placeholder="请输入远程链接地址http:" id="url" name="url">
					</div>
					<div class="col-3">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-3 col-sm-2">栏目描述：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<textarea name="mark" id="mark" cols="" rows="" class="textarea"  placeholder="说点什么...100个字符以内" onKeyUp="textlength()">{$data.mark}</textarea>
						<p class="textarea-numberbar"><em class="textarea-length">{$data.mark|mb_strlen}</em>/100</p>
					</div>
					<div class="col-3">
					</div>
				</div>
				
				<div class="row cl" id="yin" {if condition="$data.type != 2 "} style='display: none;' {/if} >
					<label class="form-label col-xs-3 col-sm-2">单页显示内容：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<script id="danye" type="text/plain" style="width:100%;height:400px;">{$data.editorValue|raw}</script> 
					</div>
					<div class="col-3">
					</div>
				</div>
				
				<div class="row cl">
					<div class="col-9 col-offset-2">
						<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
					</div>
				</div>
			</div>
		</div>
	</form>
</div>
{include file="common/_footer" /}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__MANAGE__lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="__MANAGE__lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="__MANAGE__lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="__MANAGE__lib/ueditor/ueditor.config.js"></script> 
<script type="text/javascript" src="__MANAGE__lib/ueditor/ueditor.all.min.js"> </script> 
<script type="text/javascript" src="__MANAGE__lib/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="__MANAGE__lib/function.js"></script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	$("#tab-category").Huitab({
		index:0
	});
	$("input[type=\"submit\"]").on('click',function () {
		let wo=$("#form-category-add").validate({
			rules:{
				fid:{
					required:true,
				},
				catename:{
					required:true,
				},
			},
		});
		if(wo.form()){
			setTimeout(()=>{
				$("input[type=\"submit\"]").addClass('disabled').attr("disabled",true);
			},1000)
			var index = layer.load(1, {
				shade: [0.1,'#fff'] //0.1透明度的白色背景
			});
			// 关闭当前界面
			// var index = parent.layer.getFrameIndex(window.name);
			// parent.layer.close(index);
		}
	})

	  
   $("#type").change(function () {
   	
   	if (this.value== "2"){
   		$('#yin').show();
   		$('#lian').hide();
   		$('#catehtml').show();
   		$('#showhtml').hide();
   		return false;
   	}
   	if (this.value== "4"){
   		$('#yin').hide();
   		$('#lian').show();
   		$('#catehtml').hide();
   		$('#showhtml').hide();
   		return false;
   	}
   	$('#yin').hide();
   	$('#lian').hide();
   	$('#catehtml').show();
   	$('#showhtml').show();
   })
	
var ue = UE.getEditor('danye');
});
function textlength(){
	var nmb=$('#mark').val().length;
	if(nmb>100){
		$('#mark').css("background-color","orangered");
		$('#mark').val($('#mark').val().substr(0,100));
		$('.textarea-length').text(100);
	}else{
		$('#mark').css("background-color","white");
		$('.textarea-length').text(nmb);
	}
}
function zhuan(){
	$('#en_name').val(getPinYinByName($('#catename').val()));    
}
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>